1 <?php
2 session_start();
3 include("header.php");
4 include("sidebar.php");
5 include("dbconnection.php");
6 if(isset($_POST["submit"]))
7 {
8 move_uploaded_file($_FILES["file"]["tmp_name"], "upload/".$_FILES["file"]["name"]);
9 $img = $_FILES["file"]["name"];
10 if(empty($img))
11 {
12 $img = $_POST['image'];
13 }
14
15 $sql ="insert into vehiclestore(empid,vehname,model,brand,images,estprice,description,status) values('$_SESSION[empid]','$_POST[vehname]','$_POST[model]','$_POST[brand]','$img','$_POST[estprice]','$_POST[description]','Pending')";
16 $ctins = 1;
17 if (!mysql_query($sql,$con))
18 {
19 die('Error: ' . mysql_error());
20 }
21 $sql1 = mysql_query("update vehicle set status='Accepted' where sellno='$_GET[sellno]'");
22 }
23
24 ?>
25 <?php
26 if(isset($_GET['sellno']))
27 {
28 $result = mysql_query("select * from vehicle where sellno='$_GET[sellno]'");
29 $row = mysql_fetch_array($result);
30 }
31 ?>
32 <?php
33 if($ctins == 1)
34 {
35 echo "<center><b>Vehicle Added to vehicle store Successfully...</b></center><br>";
36 }
37 else
38 {
39 ?>
40 <div id="main">
41
42 <a name="TemplateInfo"></a>
43 <h1>Vehicle store</h1>
44 <form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
45 <table width="325", border="0">
46 <tr>
47 <th height="33" scope="row">Vehicle Name
48 <label for="lname"></label></th>
49 <td><label for="vehname"></label>
50 <label for="sparetype"></label>
51 <label for="vehname3"></label>
52 <input type="text" name="vehname" value="<?php echo $row['vehname']; ?>" id="vehname" /></td>
53 </tr>
54 <tr>
55 <th height="28" scope="row">Model</th>
56 <td>
57 <label for="email"></label>
58 <label for="model"></label>
59 <label for="vehicleno"></label>
60 <label for="spareno"></label>
61 <label for="sparename2"></label>
62 <label for="model2"></label>
63 <input type="text" name="model" value="<?php echo $row['model']; ?>" id="model" />
64 </td>
65 </tr>
66 <tr>
67 <th height="31" scope="row">Brand</th>
68 <td><label for="password"></label>
69 <label for="date"></label>
70 <label for="description"></label>
71 <label for="brand"></label>
72 <input type="text" name="brand" value="<?php echo $row['brand']; ?>" id="brand" /></td>
73 </tr>
74 <tr>
75 <th height="36" scope="row">Images</th>
76 <td><label for="confpass"></label>
77 <label for="images"></label>
78 <label for="address"></label>
79 <label for="image"></label>
80 <label for="images2"></label>
81 <label for="images3"></label>
82 <label for="file"></label>
83 <input type="file" name="file" id="file" /><input type="hidden" value="<?php echo $row['images']; ?>" name="image" />
84 <img src="upload/<?php echo $row['images']; ?>" width="75" height="75"></img>
85 </td>
86 </tr>
87 <tr>
88 <th height="33" scope="row">Estimated Price</th>
89 <td><label for="estprice"></label>
90 <input type="text" name="estprice" value="<?php echo $row['estmdprice']; ?>" id="estprice" /></td>
91 </tr>
92 <tr>
93 <th height="30" scope="row">Description</th>
94 <td><label for="description2"></label>
95 <textarea name="description" id="description2"><?php echo $row['otherinfo']; ?></textarea></td>
96 </tr>
97
98 <tr>
99 <th scope="row"> </th>
100 <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
101 </tr>
102 </table>
103 </form>
104 <?php
105 }
106 ?>
107 <p> </p>
108 <br />
109
110 </div>
111
112 <!-- wrap ends here -->
113 </div>
114
115 <?php
116 include("footer.php");
117 ?>